using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

using ScenarioFramework.Modules.FormHelper;
using ScenarioFramework.Modules.DM.DataBase;
using ScenarioFramework.Modules.DM.DataModel;

namespace ACEMPortal.ACEM.Forms
{
	/// <summary>
	/// Summary description for ProposalConfirmed.
	/// </summary>
	public partial class DocumentInstanceInfo : System.Web.UI.Page
	{
		protected void Page_Load(object sender, System.EventArgs e)
		{
			if (!Page.IsPostBack)
			{
				string sDocumentId = Request.QueryString ["DocumentId"];

				DocumentManagerDBHelper dmDBHelper = new DocumentManagerDBHelper();
				XMLDocumentInstance document = dmDBHelper.GetDocumentInstance( sDocumentId );

				if ( document.IdMaster.CompareTo (string.Empty ) == 0 ) 
				{
					Session["MasterDocumentInstance"] = document;
				}
				else
				{
					XMLDocumentInstance documentMaster = dmDBHelper.GetDocumentInstance( document.IdMaster );
					Session["MasterDocumentInstance"] = documentMaster;
				}

				string sDocumentVersion = document.XMLDocumentVersions.GetLastVersion().Id;
				Session["DocumentVersion"] = sDocumentVersion ;
				Session["DocumentInstance"] = document;

			}
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{    

		}
		#endregion
	}
}
